/*
 * acm2876.c
 *
 *  Created on: 5 Apr 2010
 *      Author: xuxu
 */

#include<stdio.h>
#include<string.h>

int cmp(const void *a,const void *b)
{
	return strcmp((char *)a,(char *)b);
}

int finder(char *a,char *b)
{
	int len1,len2,len;
	int i,j;
	len1=strlen(a);
	len2=strlen(b);
	len=len1>len2?len2:len1;
	for(i=0;i<len;i++)
	{
		if(a[i]!=b[i])
			return 0;
	}
	return 1;
}

int main()
{
	int count,n;
	char word[10001][12];
	int i,j;
	int bo;
	scanf("%d",&count);
	while(count--)
	{
		scanf("%d",&n);
		for(i=0;i<n;i++)
			scanf("%s",word[i]);
		qsort(word,n,sizeof(char)*12,cmp);
		bo=0;
		for(i=0;i<n-1;i++)
		{
			if(finder(word[i],word[i+1]))
			{
				bo=1;
				break;
			}
		}
		if(bo)
			printf("NO\n");
		else
			printf("YES\n");
	}
	return 0;
}
